﻿using System;

namespace Fee.VendorMatchers
{
    public class ConstructionVendorMatcher : VendorMatcher
    {
        private static readonly DateTimeOffset Date2018 =
            new DateTimeOffset(new DateTime(2018, 1, 1), new TimeSpan(0, 8, 0, 0));

        public ConstructionVendorMatcher() : base(ContractType.Construction)
        {
        }

        /// <summary>
        /// </summary>
        public StationType StationType { get; set; }

        public bool IsVip { get; set; }
        
        protected override bool IsMatchStation(Station station)
        {
            //如果都是vip，那么就无所谓。

            var result = base.IsMatchStation(station) || station.IsVip && IsVip;
            //1)	室分与无线大站的一致（17年前室分管，17年后集家客管）
            var before2017 = station.CreateTime < Date2018;
            if (result && before2017)
                return result &&
                       station.Type == StationType.IDS &&
                       (StationType == StationType.CustomerGroupCoverage
                        ||
                        StationType == StationType.FamilyCoverage);


            return result && station.Type == StationType;
            ;
        }
    }
}